<template>
  <el-dialog
    :title="temp.phone_num + '-手机卡信息'"
    :visible.sync="dialog_visible"
    width="60%"
  >
    <div class="form-padding">
      <el-form
        ref="dataForm"
        :rules="rules"
        :model="temp"
        label-position="left"
        auto-complete="on"
        label-width="90px"
        style="width: 100%"
      >
        <!-- <el-form-item label="序号" prop="id">
          <el-input disabled v-model="temp.id" />
        </el-form-item> -->
        <!-- <el-form-item label="手机号" prop="phone_num">
          <el-input
            placeholder="请输入手机号"
            style="width: 100%"
            v-model="temp.phone_num"
            readonly
          />
        </el-form-item> -->
        <el-form-item label="实名人" prop="belong_to">
          <el-input
            placeholder=""
            style="width: 100%"
            readonly
            v-model="temp.belong_to"
          />
        </el-form-item>
        <el-form-item label="月套餐" prop="tel_package">                  
          <el-input
            type="textarea"
            readonly
            :rows="5"
            placeholder=""
            v-model="temp.tel_package"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="流量" prop="tel_traffic">
          <el-input
            placeholder=""
            readonly
            style="width: 100%"
            v-model="temp.tel_traffic"
          />
        </el-form-item>
        <el-form-item label="卡类型" prop="tel_type">
          <el-input
            placeholder=""
            readonly
            style="width: 100%"
            v-model="temp.tel_type"
          />
        </el-form-item>
        <el-form-item label="流量优惠到期日" prop="discount_exp_date">
          <el-date-picker
            style="width: 100%"
            readonly
            v-model="temp.discount_exp_date"
            type="date"
            placeholder=""
          />
        </el-form-item>
        <el-form-item label="微信密码" prop="wechat_pwd">
          <el-input
            placeholder=""
            readonly
            style="width: 100%"
            v-model="temp.wechat_pwd"
          />
        </el-form-item>
      </el-form>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { update,typeArray } from "@/api/adm_cart";
import Tinymce from "@/components/Tinymce/tinymce";
import g from "@/utils/utilFn";
export default {
  name: "cartEdit",
  components: { Tinymce },
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    data: {
      type: Object,
      default: function () {
        return {};
      },
    },
  },
  data() {
    return {
      fresh: false,
      toolBar: [
        "searchreplace bold italic underline strikethrough alignleft aligncenter alignright",
        "hr bullist numlist link  emoticons forecolor fullscreen",
      ],
      temp: {
        id: "",
        phone_num: "",
        belong_to: "",
        tel_package: "",
        tel_traffic: "",
        tel_type: "主卡",
        discount_exp_date: "",
        wechat_pwd: "",
      },
      rules: {     
      },
    };
  },
  computed: {
    dialog_visible: {
      get() {
        return this.show;
      },
      set(val) {
        this.$emit("update:show", val);
      },
    },
  },
  watch: {
    data: {
      handler(newValue, oldValue) {
        this.temp = Object.assign({}, this.data);
        // 当 watchedObject 或其内部属性变化时，这个函数被调用
      },
      deep: true,
    },
    dialog_visible(newValue, oldValue) {
      if (newValue) {
        this.fresh = true;
      }
    },
  },
  created() {
    this.typeArray = typeArray;
  },

  methods: {
    cancel() {
      this.dialog_visible = false;
    } 
  },
};
</script>